﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace KS.DataWrapper.DataWrapper
{
    public partial class DataCacheObject<T> : IEnumerable<T>
    {
        private ObservableCollection<T> observableCollection;

        public ObservableCollection<T> ToObservableCollection()
        {
            return new ObservableCollection<T>(nativeCollection.Select(s => s.Value).ToList<T>());
            
        }

        public List<T> ToList()
        {
            return nativeCollection.Select(s => s.Value).ToList<T>();
        }

        public IQueryable<T> AsQueryable()
        {
            return nativeCollection.Select(s => s.Value).ToList().AsQueryable<T>();
        }

        public IEnumerable<T> AsEnumerable()
        {
            return nativeCollection.Select(s => s.Value);
        }

        public IEnumerable<T> ToEnumerable()
        {
            return nativeCollection.Select(s => s.Value);
        }

        public T[] Items
        {
            get
            {
                return nativeCollection.Select(s => s.Value).ToArray<T>();
            }
        }
    }
}